package com.sugon.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * @Description: 关键零部件
 * @author: YuXD
 * @since: 2022-10-08
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class SparePartKeyCj implements Serializable {
    private static final long serialVersionUID = 1L;

    private String id;

    private String keySpId;

    /**
     * 备件ID
     */
    private String spId;

    private String workshop;

    private String devId;

    private String position;

    /**
     * 计算寿命的方式
     */
    private String computeLifeWay;

    /**
     * 实际寿命
     */
    private Long actualLife;

    /**
     * 最近一次更换时间
     */
    private Date lastReplaceTime;

    private Integer delFlag;

    private String remark;

    private String createBy;

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    private String updateBy;

    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /***********************VO字段*************************/
    private Long ul;

//    public Long getUl() {
//        if (life != null && this.lastReplaceTime != null) {
//            long betweenDays = DateUtil.betweenDay(this.lastReplaceTime, DateUtil.date(), true);
//            return life >= betweenDays ? life - betweenDays : 0;
//        }
//        return ul;
//    }

}
